Detection circuit for an active discharge circuit of an x-capacitor, related active discharge circuit, integrated circuit and method

ABSTRACT

An active discharge circuit discharges an X. The detection circuit includes a sensor circuit that generates a sensor signal indicative of an AC oscillation voltage at the X capacitor. The detection circuit also includes a processing unit that generates the reset signal as a function of a comparison signal. A comparator circuit generates the comparison signal by comparing the sensor signal with a threshold. A timer circuit sets a discharge enable signal to a first logic level when the timer circuit is reset via a reset signal. The timer circuit determines the time elapsed since the last reset and tests whether the time elapsed exceeds a given timeout value. If the time elapsed exceeds the given timeout value, the timer circuit sets the discharge enable signal to a second logic level. A dynamic threshold generator circuit varies the threshold of the comparator circuit as a function of the sensor signal.

BACKGROUND

1. Technical Field

Embodiments of the present disclosure relate to circuits for discharging an X capacitor.

2. Description of the Related Art

FIG. 1a shows an example of a device 10 a being powered via an input voltage V_(in) provided by an external AC power supply source 20, such as the mains having, e.g., 230 VAC or 110 VAC. For example, typically the device 10 a includes a connector 102, such as a plug, comprising two terminals 102 a and 102 b for connection to the external AC power source 20 and the AC power supply signal V_(in) received via the connector 102 is provided to some kind of electric load 106.

The device 10 a may also include a capacitor 104 directly connected to the AC input connector 102, which is usually called X-capacitor or X-cap. For example, such X-capacitors are often used in switched mode power supplies (SMPS).

FIG. 1b shows in this respect an example of a typical switched mode power supply 10 b. Specifically, in the example considered, the electric load 106 of FIG. 1a is now represented by a rectifier circuit 110, such as a diode bridge rectifier, configured to convert the AC power supply signal V_(in) into a DC power supply signal, and an electronic converter 112, such as a DC/DC switching converter, which may feed a load 114, such as an external load 114 a and/or an internal load 114 b. For example, in this case, the capacitor 104 may be configured to filter EMI (electromagnetic interference) noise coming from the switching activity of the switching converter 112.

Safety regulations, such as the international standard IEC60950, may require that such devices 10 a and 10 b, indicated in the following simply as device 10, include a discharge circuit 108 configured to discharge the capacitor 104, when the connector 102 is disconnected from the AC power source 20, thus reducing the risk of electric shocks in case a user touches the connector 102 of a disconnected device 10. For example, usually such discharge circuits 108 are required when the capacitance of the capacitor 104 is greater than a given value, such as 0.1 μF.

For example, often a device 10 is considered to be compliant with the technical regulation when the discharge circuit 108 may discharge such an X-capacitor 104 (and possible other capacitances connected between the power supply lines feeding the load 106) with a given maximum discharge time constant. For example, often the discharge time constant is calculated as the effective capacitance (μF) connected to the connector 102 multiplied by the effective resistance of the discharge path of the discharge circuit 108. Whenever these values cannot be easily defined, the effectiveness of the discharge circuit 108 is often evaluated by the measure of the time needed to reduce the voltage at the capacitor 104 down to, e.g., 0.37 times the initial value. For example, typically the discharge time constant should be lower than 1 second for “type A” equipment with AC plug connection, or 10 seconds for permanent installed equipment and “type B” equipment with AC plug connection.

For example, the discharge circuit 108 may comprise a resistor connected in parallel with the capacitor 104. In this case, the resistance of the resistor could be dimensioned in order to discharge the capacitor 104 according to the applicable safety regulations.

The drawback of this solution resides in the fact that such an additional resistor also consumes power when the device 10 is connected to the AC power source 20, thereby reducing the efficiency of the device 10.

This problem may be particularly relevant for switched mode power supplies as shown, e.g., in FIG. 1 b.

In fact, such switched mode power supply 10 b could also be connected to the AC power source 20, when the load 114 is disconnected, switched off or in a low power mode, such as a standby mode. For example, this may apply to a notebook adapter connected to the AC mains when the notebook (represented in this case by external load 114 a) is disconnected or switched off. In this case the consumption of the resistor may represent a considerable part of the adapter power consumption.

In order to overcome this problem, the discharge circuit 108 may also be an active discharge circuit, which discharges the capacitor 104 only when the connector 102 is disconnected from the AC power source 20, thereby reducing the power consumption of the discharge circuit 108 when the device 10 is connected to the AC power source 20.

BRIEF SUMMARY

The inventors have observed that one part of such an active discharge circuit is the detection circuit used to detect a disconnection from and/or connection to the AC power source.

The present disclosure provides arrangements which permit improvement of this detection.

According to one or more embodiments, a detection circuit for an active discharge circuit of an X-capacitor has the features specifically set forth in the claims that follow. The present disclosure also relates to a related active discharge circuit and integrated circuit comprising the detection circuit, and a related method.

The claims are an integral part of the technical teaching of the embodiments provided herein.

As mentioned in the forgoing, the detection circuit is part of an active discharge circuit that is used to discharge an X capacitor of a device, in particular a switched mode power supply. Generally, the detection circuit is configured to generate a discharge enable signal signaling the presence or absence of an AC oscillation applied to said X capacitor.

In some embodiments, the detection circuit comprises a sensor circuit, such as a voltage divider with associated rectifier circuit, for connection to the X capacitor. In particular, this sensor circuit is configured to generate a sensor signal being indicative of the voltage at the X capacitor, such as a scaled down version and/or rectified version of the voltage at the X capacitor.

In some embodiments, the detection circuit comprises a comparator circuit comprising one or more comparators. Accordingly, the comparator circuit generates at least one comparison signal by comparing the sensor signal with at least one threshold.

In some embodiments, the detection circuit comprises a timer circuit, such as a digital counter, configured to determine whether a given time has lapsed since the last reset event and set the discharge enable signal accordingly. For example, the time circuit may set the discharge enable signal to a first logic level when the timer circuit is reset via a reset signal. Next, the timer circuit may determine the time elapsed since the timer circuit has been reset and in case the time elapsed exceeds a given timeout value, the timer circuit may set the discharge enable signal to a second logic level.

In some embodiments, an elaboration circuit is used to generate this reset signal for the timer circuit as a function of the at least one comparison signal provided by the comparison circuit.

In some embodiments, the detection circuit comprises also a dynamic threshold generator circuit configured to vary the at least one threshold of the comparator circuit as a function of the sensor signal.

For example, in some embodiments, the dynamic threshold generator circuit is configured to vary the at least one threshold of the comparator circuit in a feed-forward manner directly as a function of the sensor signal.

For example, in this case, the dynamic threshold generator circuit may comprise a peak detector circuit configured to determine an upper threshold or peak value of the sensor signal, and a threshold generator circuit configured to determine a lower threshold value as a function of this upper threshold value.

In this case, the comparator circuit may determine whether the sensor signal is greater than the lower threshold value, or alternatively between the lower and the upper threshold value. Accordingly, a raising edge in the signal at the output of the comparator indicates that the sensor signal has a positive slope, while a falling edge in the signal at the output of the comparator indicates that the sensor signal has a negative slope.

In some embodiments, the elaboration circuit may therefore reset the timer circuit when the comparison signal comprises a leading and/or a falling edge. The elaboration circuit may also determine the time elapsed between a leading and a falling edge, and reset the timer circuit when this time is smaller than a given time threshold value.

In some embodiments, the dynamic threshold generator circuit may vary the at least one threshold of the comparator circuit also in a feed-back manner as a function of the at least one comparison signal at the output of the comparator circuit.

For example, in this case, the comparator circuit may comprise two comparators which generate a first and a second comparison signal indicating whether the sensor signal is greater than a first and a second threshold value, respectively. Accordingly, the comparison signals indicate whether the sensor signal is smaller than, between or greater than the first and a second threshold value.

In some embodiments, the dynamic threshold generator circuit may thus increase the smaller one of the first or the second threshold values, when the sensor signal is greater than both the first and the second threshold values, or decrease the greater one of the first or the second threshold values, when the sensor signal is smaller than both the first and the second threshold value, i.e., the threshold values are always adapted such that the sensor signal is between the first and the second threshold value. Accordingly, the smaller threshold value is increased due to a positive slope in the sensor signal, while the greater threshold value is decreased due to a negative slope in the sensor signal.

This behavior may be used to reset the timer circuit. For example, in some embodiments, the elaboration circuit resets the timer circuit each time the smaller threshold value is increased, i.e., each time the comparator circuit indicates that the sensor signal is greater than both threshold values.

Accordingly, the detection circuit generally determines the presence of an AC voltage between two terminals, which are usually connected to the X-capacitor of a device, such as a switched mode power supply. Accordingly, such a detection circuit is particularly useful in an active discharge circuit adapted to discharge such an X capacitor.

Generally, the detection circuit or the complete active discharge circuit may also be integrated in a digital and/or analog integrated circuit, for example the driver circuit of a switched mode power supply.

BRIEF DESCRIPTION OF THE SEVERAL VIEWS OF THE DRAWINGS

Embodiments of the present disclosure will now be described with reference to the annexed drawings, which are provided purely by way of non-limiting example and in which:

FIGS. 1a and 1b are functional diagrams of devices including conventional discharge circuits;

FIG. 2 shows a device comprising an X-capacitor in accordance with one embodiment of the present disclosure;

FIG. 3 shows an embodiment of an active discharge circuit for the device of FIG. 2;

FIG. 4 shows an embodiment of a detection circuit for the active discharge circuit of FIG. 3;

FIGS. 5a and 5b show typical waveforms occurring in the detection circuit of FIG. 4;

FIG. 6 shows a first embodiment of a processing unit of the detection circuit shown in FIG. 4;

FIGS. 7, 8 and 9 show waveforms which may occur in the processing unit of FIG. 6;

FIG. 10 shows a second embodiment of a processing unit of the detection circuit shown in FIG. 4;

FIGS. 11, 13 and 16 show details of the processing unit of FIG. 10;

FIGS. 12a and 12b show waveforms which may occur in the processing unit of FIG. 10; and

FIGS. 14 and 15 show further details of embodiments of the active discharge circuit of FIG. 3.

DETAILED DESCRIPTION

In the following description, numerous specific details are given to provide a thorough understanding of embodiments of the present disclosure. The embodiments can be practiced without one or several of these specific details, or with other methods, components, materials, etc. In other instances, well-known structures, materials, or operations are not shown or described in detail to avoid obscuring aspects of the described embodiments.

Reference throughout this specification to “one embodiment” or “an embodiment” means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment. Thus, the appearances of the phrases “in one embodiment” or “in an embodiment” in various places throughout this specification are not necessarily all referring to the same embodiment. Furthermore, the particular features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

The headings provided herein are for convenience only and should not limit the scope or meaning of the embodiments.

In the following figures parts, elements or components which have already been described with reference to FIG. 1 are denoted by the same references previously used in such figure. The description of such previously described elements will not be repeated in the following in order not to overburden the present detailed description.

As mentioned in the foregoing, the present disclosure provides solutions for discharging an X-capacitor.

FIG. 2 shows an embodiment of a device 30 in accordance with the present disclosure.

Similar to the devices shown in FIGS. 1a and 1b , the device 30 includes a connector 302, such as a plug, comprising at least two power supply terminals 302 a and 302 b for connection to the external AC power supply 20 and the AC power supply signal V_(in) received via the terminals 302 a and 302 b is provided to a load.

For example, in an embodiment, the AC power supply signal received via the terminals 302 a and 302 b is provided to a rectifier 310, such as a bridge rectifier, which converts the AC power supply signal in a DC power signal, which is provided via a positive power line 316 a and a negative power line 316 b, which represents a ground GND, to a DC load 312.

For example, in an embodiment, the DC load may be a DC/DC or DC/AC switching converter 312, which provides a regulated power supply signal to an external and/or internal load indicated with the reference signs 314 a and 314 b, respectively. For example, typical topologies for switching converters are buck, boost, buck-boost, flyback, forward, half-bridge or full-bridge converters, which are well known to those skilled in the art, rendering a detailed description herein unnecessary.

In the embodiment considered, the device 30 also includes an X-capacitor 304, i.e., at least one capacitor being connected (e.g., directly) between the terminals 302 a and 302 b.

In the embodiment considered, the device 10 comprises further an active discharge circuit 308 configured to selectively discharge the capacitor 304.

FIG. 3 shows an embodiment of an active discharge circuit 308 in accordance with one embodiment of the present disclosure.

Specifically, in the embodiment considered, the active discharge circuit 308 comprises a detection circuit 40 configured to determine whether the connector 302 has been disconnected from the AC power source 20 and a discharge circuit 50 driven via a signal EN provided by the detection circuit 40 and configured to discharge the capacitor 304 when the signal EN indicates that the connector 302 has been disconnected from the AC power source 20.

Generally, when the device 30 is connected to the AC voltage source 20, the voltage V_(X) at the capacitor 304, i.e., the voltage between the terminals 302 a and 302 b, is a sinusoidal signal, i.e., an oscillation having a given amplitude and frequency, e.g., an amplitude of 230V and a frequency of 50 Hz.

Thus, by detecting an AC oscillation at the capacitor 304, the detection circuit 40 may determine whether the device 30 is connected to the AC power source 20 or not.

FIG. 4 shows a possible embodiment of the detection circuit 40.

In the embodiment considered, the detection circuit 40 comprises an optional rectifier circuit 402, a voltage sensor 404 and a processing unit 406.

Specifically, the optional rectifier circuit 402 is interposed between the capacitor 304 and the voltage sensor 404, wherein the rectifier circuit 402 is configured to convert the AC voltage signal V_(X) at the capacitor 104 into a DC voltage signal.

Conversely, the voltage sensor 404 is configured to measure the voltage at the output of the rectifier circuit 402 (or in alternative directly at the capacitor 304). Accordingly, generally, a signal S provided at the output of the voltage sensor 404 is representative of the voltage V_(X) at the capacitor 304.

For example, FIG. 14 shows a possible embodiment of the voltage sensor 404, which is particularly suitable for devices comprising already a rectifier 310, such as a bridge rectifier.

In the embodiment considered, the voltage V_(X) at the capacitor 304 is rectified via a rectifier circuit 402. Specifically, in the embodiment considered, the rectifier comprises two diodes D₁ and D₂. More specifically, the anode of the diode D1 is connected to a first terminal of the capacitor 304, e.g., to the terminal 302 a, and the anode of the diode D2 is connected to the second terminal of the capacitor 304, e.g., to the terminal 302 b. The cathodes of the diodes D₁ and D₂ are connected (preferably directly) together and provide thus always a positive voltage.

In particular, merely two diodes D₁ and D₂ are sufficient, because the ground GND provided by the rectifier 310 may be used as negative reference for this voltage.

Conversely, e.g., in case the rectifier 310 is missing, a full bridge rectifier could be used in the rectifier circuit 402.

The positive voltage provided at the cathodes of the D₁ and D₂ is provided to the voltage sensor 404.

For example, in the embodiment considered, a voltage divider comprising two resistors R1 and R2 connected in series is used as voltage sensor 404. Specifically, in the embodiment considered the voltage divider is connected between the connection point of the cathodes of the diodes D₁ and D₂ and the ground GND, and the intermediate point between the resistors R1 and R2 provides the sensor signal S. Accordingly, in the embodiment considered, the signal S corresponds to a positive voltage with respect to the ground GND and corresponds to a rectified and scaled down version of the voltage V_(X) at the capacitor 304.

Thus, when the device 30 is connected to the AC power source 20 the signal S may have different waveforms which primarily depend on the presence and implementation of the rectifier circuit 402. For example, generally, the signal S may be an AC sinusoidal oscillation, a positive sinusoidal oscillation (e.g., by adding a DC offset to the AC oscillation), a rectified sinusoidal oscillation, or a waveform comprising only each second half-wave (e.g., by using only a single diode, e.g., diode D₁ or D₂, in the rectifier circuit 402).

Finally, the processing unit 406, which may be implemented by any suitable analog and/or digital circuit, elaborates the sensor signal S and determines the signal EN as a function of the sensor signal S.

Generally, the discharge circuit 50 (FIG. 3) includes at least one electronic switch SW configured to selectively discharge the capacitor 304 as a function of the signal EN. In order to limit the discharge current, a resistor, or generally a resistive element, or a current generator (generating a linear/non-linear current and/or a constant/non-constant current) could also be connected in series with such an electronic switch SW. Accordingly, such an electronic switch SW could be connected, e.g., in parallel with the capacitor 304.

Conversely, if the device 30 includes a rectifier 310, the electronic switch SW could also discharge the capacitor 304 to ground GND.

For example, FIG. 15 shows an embodiment of the discharge circuit 50 which may be used in combination with the voltage sensor 404 shown in FIG. 14. In fact, in this embodiment, the connection point of the cathodes of the diodes D₁ and D₂ always provides a positive voltage with respect to the ground GND, i.e., the negative line at the output of the rectifier 310. Accordingly, in this case an electronic switch SW, such as a metal-oxide-semiconductor field-effect transistor (MOSFET), e.g., with n channel, may be connected between the connection point of the cathodes of the diodes D₁/D₂ and ground GND, wherein the control gate of the electronic switch SW is driven via the signal EN.

Generally, also in this case a disconnection event should not be detected by simply checking whether the signal S is greater than a given threshold, because when the connector 302 (FIG. 3) is disconnected, the capacitor 304 may be charged to any value between zero and the maximum line voltage. Therefore the use of a constant fixed threshold is not a reliable way to implement the detection.

Moreover, detection is complex also because possible further components of an EMI filter placed upstream the connector 302 could introduce distortions in the sensed voltage S. Furthermore, often it is also not possible to exactly predict the distortion, which often depends on the operative conditions of the electric load of the device.

Finally, in particular in the context of switched mode power supplies, the sensor signal S could also not decrease gradually when the device 30 is disconnected, but the subsequent electronic converter 310 could still consume energy leading to voltage profiles similar to a linear or step-down slow discharge.

For example, FIGS. 5a and 5b show two possible waveforms of the signal S, in the case of a switched mode power supply with or without output load, respectively.

Specifically, in the examples considered, once the plug is disconnected at a time t₀, the discharge time of the capacitor 304 varies significantly between the waveforms shown in FIGS. 5a and 5b . For example, the discharge behavior shown in FIG. 5a is quite similar to a decreasing sinusoidal waveform.

Accordingly, a disconnection event could be detected by comparing the maximum peak of the AC voltage, which corresponds to the amplitude of the oscillation, with a given voltage reference. However, this solution would require the knowledge of the nominal amplitude of the AC voltage, which may also vary from 80 VAC to 260 VAC for different countries.

Thus, generally, the voltage at the capacitor 304 could be compared with a fixed lower voltage reference, such as 70 V. However, additional components, in particular inductors in the EMI filter, may introduce distortions in the signal S.

For example, this may be particularly relevant, when the signal S is measured with respect to the ground GND downstream the rectifier 310 as shown, e.g., in FIG. 15. In this case, the shape of the sensed signal S is also strongly dependent on the load conditions.

In this context, the inventors have observed that the peak value is almost defined by the AC mains peak value, but the lowest value (the so called valley value) depends strongly on the load conditions. For example, often this is due to the finite (and different from zero) value of the EMI filter impedance. Accordingly, in the case of a heavy load the valley value of signal S would be low, even close to zero. On the other hand, the valley value will be higher at light load conditions. Because of this a fixed low threshold could lead to a missed or wrong detection of the AC mains (with an undesired activation of the X-capacitor discharge).

FIG. 6 shows a first embodiment of a processing unit 406 a in accordance with the present disclosure.

Specifically, in the embodiment considered, instead of using a fixed and preconfigured voltage reference, the solution determines a dynamic voltage threshold.

Specifically, in the embodiment considered, the processing unit 406 a comprises comparator circuit 412 a, a dynamic threshold generator circuit 416 a, an elaboration circuit 418 a and a timer circuit 414 a.

Specifically, the dynamic threshold generator circuit 416 a is configured to provide one or more threshold values for the comparator circuit 412 a as a function of the signal S.

For example, in the embodiment considered, the dynamic threshold generator circuit 416 a comprises a peak detector 408 and a threshold generator circuit 410.

Specifically, the peak detector 408 is configured to detect the maximum value in the signal S. For example, suitable peak detectors are described in the patent application U.S. Ser. No. 14/510,925 filed on Oct. 9, 2014, which is incorporated for this purpose herein by reference in its entirety.

Accordingly, when the device 30 is connected to the AC power source 20, the peak detector 408 will provide after one or more oscillations of the AC power signal the maximum value of the signal S, which represents the amplitude of the oscillation of the voltage V_(X) at the capacitor 304. Accordingly, this peak value represents an upper dynamic threshold DHT for the signal S.

In the embodiment considered, the threshold generator circuit 410 uses this signal in order to generate at least one threshold value, such as a reference voltage signal, for the comparator circuit 412 a.

For example, in an embodiment, the comparator circuit 412 a comprises a single comparator configured to compare the signal S with a lower threshold DLT. In this case, the threshold generator circuit 410 may be configured to determine dynamically this lower threshold value DLT as a function of the upper dynamic threshold DHT. For example, the lower threshold DLT may be calculated by subtracting a given value from the threshold DHT, such as 20-50V, or by scaling the threshold DHT with a given percentage, such as 90%. Generally, the difference between the two thresholds may also be programmable, e.g., by means of software, trimming or metal options.

Accordingly, the lower threshold value DLT corresponds to a dynamic threshold which is determined as a function of the peak value of the voltage at the capacitor 304. Accordingly, in the embodiment considered, a signal OVTH at the output of the comparator 412 a indicates weather the signal S, being indicative of the voltage at the capacitor 304, is greater than the lower threshold DLT.

For example, FIG. 7 shows a possible waveform for the signal OVTH which is set to a first logic level, e.g., “1”, when the voltage at the capacitor 304 is greater than the lower threshold DLT and to a second logic level, e.g., “0”, when the voltage at the capacitor 304 is smaller than the lower threshold DLT. Accordingly, as long as the AC power source 20 is connected to the device 30, a single pulse of the OVTH signal is generated for each half-wave of the rectified oscillation of the AC power source 20. Conversely, in the absence of a rectifier 316 or when using only a single diode in the rectifier circuit 316, a single pulse would be generated for each oscillation.

In an embodiment, the comparator circuit 412 a may comprise instead a window comparator configured to determine whether the signal S is between a lower and an upper threshold. In this case, the threshold generator circuit 410 may be configured to provide both the lower dynamic threshold DLT and the upper dynamic threshold DHT to the window comparator of the comparator circuit 412 a. Accordingly, in this case, the signal OVTH would indicate whether the signal S is between the lower and the upper dynamic thresholds DLT and DHT. For example, such a window comparator may improve robustness and effectiveness, and may be suitable when AC variations should be detected with higher precision/resolution

Thus, when the device 30 is connected to the AC power source 20, the signal OVTH at the output of the comparator circuit 412 a will comprise at least one pulse for a time period T corresponding to:

T=1/f _(AC).

where f_(AC) is the frequency of the AC oscillation of the AC power source 20, which is usually 50 or 60 Hz.

Conversely, such pulses will be missing, when the device 30 is disconnected from the AC power source 20.

For example, FIG. 8 shows in this respect possible waveforms for the signal S and a corresponding signal OVTH.

Accordingly, in the embodiment considered, the timer circuit 414 a is used to determine, similar to a watchdog timer or timeout counter, whether a given time period has lapsed since the last pulse occurred in the signal OVTH.

For example, such a timer circuit 414 a may be implemented with a counter, which increases or decreases a count value until a given value has been reached and which is reset to a given initial value based on a reset signal RESET. Accordingly, in this case, such a timer circuit 414 a may be reset as a function of the signal OVTH.

For example, in the embodiment considered, the signal OVTH is provided for this purpose to the elaboration circuit 418 a, which determines a signal RESET for the timer circuit 414 a as a function of the signal OVTH.

For example, in an embodiment, the elaboration circuit 418 a is configured (based on the logic values of the signal OVTH) to reset or restart the timer circuit 414 a at each raising edge of the signal OVTH, which represents a positive slope in the signal S. Accordingly, in this case, the timer circuit 414 a may determine whether a given time period has lapsed since a last raising edge of the signal OVTH. For example, typically the time threshold or timeout value TO for the timer circuit 414 a should correspond to several periods T of a typical oscillation of the AC power source, such as 40-100 ms. Accordingly, when the timer circuit 414 a reaches the timeout value TO, the timer circuit 414 a may enable the discharge circuit 50 via the signal EN in order to discharge the capacitor 304.

In an embodiment, the elaboration circuit 418 a may be configured to reset the timer circuit 414 a also at each falling edge of the signal OVTH. Accordingly, in this case, the timer circuit 414 a is configured to enable the discharge circuit when the timer circuit reaches a given timeout value TO since the last raising or falling edged of the signal OVTH.

Thus generally, the timer circuit 414 a enables the discharge circuit when a given time period has lapsed since the last raising and/or falling edge in the signal OVTH.

Conversely, different solutions may be used to determine when the discharge circuit 50 should be disabled or deactivated again.

For example, the timer circuit 414 a could be configured to deactivate the discharge circuit 50 only at a raising edge in the signal OVTH, which indicates a positive slope in the signal S. For example, in this case, the elaboration circuit 418 a may be configured to reset the timer circuit 414 a via the signal RESET at each raising edge in the signal OVTH.

Conversely, the timer circuit 414 a should not simply disable the discharge circuit 50 at a falling edge, because once the discharge circuit is enabled, the voltage at the capacitor 304 decreases, which could cause a falling edge in the signal OVTH.

Thus, in an embodiment, in order to avoid this problem, the elaboration circuit 418 a is configured to determine whether the signal S shows slope changes (second order derivative) and eventually resets the timer circuit 414 a.

For example, in an embodiment, the elaboration circuit 418 a is configured to determine the time elapsed between two consecutive edges in the signal OVTH, i.e., between a raising edge and a falling edge or vice versa between a falling edge and a raising edge, thereby determining two values: a first value TH indicating the duration in which the signal OVTH was high and second value TL indicating the duration in which the signal OVTH was low. In this case, the elaboration circuit 418 a may be configured to compare these durations with at least one time threshold value in order to determine whether these durations are within given limits. For example, in an embodiment the elaboration circuit 418 a may determine whether the first duration TH and the second duration TL are both smaller than a timeout value TO, which could correspond to the duration of several periods or sub-periods of a typical AC oscillation, e.g., 5, 10, 20-100 ms. Accordingly, in this case, the elaboration circuit 418 a could reset the timer circuit 414 a thus disabling the discharge circuit 50 only when the durations TH and/or TL are within the specified limits.

For example, FIG. 9 shows for this embodiment a possible waveform for the signal OVTH and a respective enable signal EN for the discharge circuit 50.

Specifically, in the example considered:

-   -   at a time t₁ the voltage of the signal S reaches the lower         voltage threshold DLT,     -   at a time t₃ the voltage of the signal S falls below the lower         voltage threshold DLT,     -   at a time t₄ the voltage of the signal S again reaches the lower         voltage threshold DLT, and     -   at a time t₅ the voltage of the signal S again falls below the         lower voltage threshold DLT.

Accordingly, in the embodiment considered, the signal OVTH includes two pulses. Moreover, in the example considered, the duration TH₁ of the first pulse and the duration TL₁ are greater than the timeout value TO and the duration TH₂ of the second pulse is smaller than the timeout value TO. Accordingly, considering the above configuration of the elaboration circuit 418 a, the timer circuit 414 a will enable the discharge circuit 50 once the time TO has elapsed since the first raising edge, i.e., at a time t₂. Conversely, the elaboration circuit 418 a will reset the timer circuit 414 a, thereby deactivating the discharge circuit 50, only at the second falling edge at time t₅, because only at this moment the elaboration circuit 414 is able to determine the duration TH₂ of the second pulse and compare this duration with the timeout value TO.

This method has the further advantage that low variation of AC input voltage may be filtered automatically.

FIG. 10 shows a second embodiment of the processing unit 406 b.

Specifically, also in this embodiment, the processing unit 406 b comprises comparator circuit 412 b, a dynamic threshold generator circuit 416 b, an elaboration circuit 418 b and a timer circuit 414 b. Also in this case, the dynamic threshold generator circuit 416 b is configured to provide at least one threshold value to the comparator circuit 412 b, which has been determined as a function of the signal S, and the elaboration circuit 418 b is configured to reset the timer circuit 414 b as a function of one or more signals at the output of the comparator circuit 412 b.

However, while in the embodiment shown in FIG. 6, the threshold value(s) were determined in a feed-forward or open-loop manner directly based on the signal S, in the embodiment considered, the threshold values are updated in a feed-back or closed loop manner based on the signals at the output of the comparator circuit 412 b.

Specifically, in the embodiment considered, the comparator circuit 412 b comprises two comparators 412 ₁ and 412 ₂, which compare the signal S with two dynamic threshold values DT₁ and DT₂ being provided by the dynamic threshold generator circuit 416 b.

Accordingly, in the embodiment considered, the signal COMP₁ at the output of the first comparator 412 ₁ indicates weather the signal S is greater than the voltage reference signal DT₁ and the signal COMP₂ at the output of the second comparator 412 ₂ indicates weather the signal S is greater than the voltage reference signal DT₂.

In the embodiment considered, the comparator circuit 412 b provides the comparison signals COMP₁ and COMP₂ to the elaboration circuit 418 b, such as a combinational circuit, which is configured to determine, based on the signals COMP₁ and COMP₂ whether the signal S is increasing or decreasing.

Specifically, in the embodiment considered, the elaboration circuit 418 b provides for this purpose a signal INC indicating that the signal S is greater than both DT₁ and DT₂, and a signal DEC indicating that the signal S is smaller than both DT₁ and DT₂.

For example FIG. 11 shows a possible embodiment of the elaboration circuit 418 b for the logic levels of the signals COMP₁ and COMP₂ which result from the connection of the signals to the positive and negative input terminals of the comparators 412 ₁ and 412 ₂ as shown in FIG. 10. Specifically, in this case, the signal INC may be obtained via an AND gate 420 and the signal DEC may be obtained via an NOR gate 422, wherein both gates receive the signals COMP₁ and COMP₂ as input.

Accordingly, the dynamic threshold generator circuit 416 b is able to determine (via the comparator circuit 412 b) whether the signal S is greater than (e.g., INC=“1” and DEC=“0”), smaller than (e.g., INC=“0” and DEC=“1”) or between the threshold values DT₁ and DT₂ (e.g., INC=“0” and DEC=“0”). In the embodiment considered, the dynamic threshold generator circuit 416 b uses this information in order to vary the thresholds DT₁ and DT₂.

For example, FIG. 16 shows a possible embodiment of dynamic threshold generator circuit 416 b. In the embodiment considered, the signals INC and DEC are provided to a digital processing unit 420, such as a microprocessor. The digital processing unit 420 elaborates the signals INC and DEC and sets the threshold values DT₁ and DT₂ via respective digital-to-analog converters DAC₁ and DAC₂.

FIG. 12a shows in that respect a possible operation of an embodiment of the dynamic threshold generator circuit 416 b.

In the embodiment considered, initially the threshold DT₁ and DT₂ are set to respective initial values, e.g., DT₁=DT_(1,0) and DT₂=DT_(2,0), wherein one of the thresholds is greater than the other one, i.e., one threshold represents a lower threshold and the other threshold represents a higher threshold, e.g., DT_(2,0)>DT_(1,0).

Once the signal INC indicates that the signal S is greater than DT₁ and DT₂, i.e., S>DT_(1,0) and S>DT_(2,0), the circuit 416 b assigns a new value to the lower threshold, wherein the new value is greater than the previous higher threshold. For example, in the example considered, the threshold DT₁ is assigned a new value DT_(1,1), with DT_(1,1)>DT_(2,0). Thus the previous lower threshold becomes the new higher threshold (being greater than the current value of the signal S) and intrinsically the signal INC changes again the logic state.

This scheme is repeated each time the signal INC goes to high, thereby following the raising slope of the signal S. For example, in the embodiment considered, the signal S exceeds three times the thresholds DT₁ and DT₂ till the thresholds are set to DT₁=DT_(1,2) and DT₂=DT_(2,1).

Accordingly, in the embodiment considered, one of the two thresholds represents a lower threshold and the other represents a higher threshold and when the signal INC indicates that the signal S is greater than both thresholds, the circuit 416 b increases the lower threshold value such that the lower threshold value becomes the new higher threshold value.

Conversely, when the signal S is decreasing again, at a given moment the signal DEC will show that the signal S is smaller than DT₁ and DT₂, i.e., S<DT_(1,2) and S<DT_(2,1). At this moment, the circuit 416 b will decrease the current higher threshold. For example, in FIG. 12a , the signal DT₁ will be set to a new value DT_(1,1), which is smaller than the current value of DT₂.

Accordingly, in the embodiment considered, when the signal DEC indicates that the signal S is smaller than both thresholds, the circuit 416 b decreases the higher threshold value such that the higher threshold value becomes the new lower threshold value.

Thus, by repeating the above operation, the processing unit 406 b is able to follow the waveform of the signal S. Moreover, the signals INC and DEC show respectively whether the signal S has a positive slop or a negative slope.

In an embodiment, at least four levels are used for each of the thresholds DT₁ and DT₂. For example, FIG. 13 shows a table of typical values of 7 levels L for each of the thresholds DT₁ and DT₂. Specifically, these values are suitable both for 110 VAC and 230 VDC applications. Those of skill in the art will appreciate that the values indicated relate to the absolute threshold values with respect to the amplitude of the voltage V_(X), which eventually should be scaled based on the ratio of the voltage detection circuit 404 b.

Generally, as shown in FIG. 12a , when the signal S decreases to zero, the thresholds may be maintained at the lowest level, e.g., levels DT_(1,0) and DT_(2,0), which are greater than zero. Accordingly, in this case, the signal DEC will remain high until the signal S increases again exceeding the lower threshold, e.g., DT_(1,0) in FIG. 12 a.

Conversely, FIG. 12b shows an embodiment, in which the processing unit 406 b assigns in this case a default value DT₀, being at most zero or even negative. Specifically, when the threshold values have reached the lowest levels, e.g., levels DT_(1,0) and DT_(2,0), and the signal DEC goes to high, the processing unit assigns to the current higher threshold this default value, e.g., DT₂=DT₀.

Thus, generally, the levels of the thresholds signals DT₁ and DT₂ are configured such that the signals INC and DEC comprise (in the presence of an AC power supply signal) a plurality of pulses for each raising or falling slope of the signal S respectively.

Accordingly, similar to the previous embodiment shown in FIG. 6, the elaboration circuit 418 b may be configured to reset the timer circuit 414 b via a signal RESET as a function of the signals provided by the comparator circuit 412 b, i.e., the signals INC and DEC.

For example, in the embodiment shown in FIG. 11, the signal RESET corresponds to the signal INC, i.e., the signal RESET comprises only the pulses of the signal INC, showing in this way a positive slope of the signal S.

However, while in the previous embodiment was required some kind of logic in order to analyze the waveform of the signal OVTH, e.g., in order to determine the raising edge of the signal OVTH, in this case, the signal INC comprises only short pulses and accordingly this signal could be used directly to reset to timer circuit 414 b.

Generally, the embodiments shown with respect to FIGS. 6 and 10 may also be combined and components may be reused, e.g., only a single timer circuit may be used instead of two separate timer circuits 414 a and 414 b. For example, in this case, the signal RESET provided by the elaboration circuit 418 a of FIG. 6 could be combined, e.g., via a logic OR gate, with the signal RESET provided by the elaboration circuit 418 b of FIG. 10.

Such a combination of the circuits provides a system solution suitable for a wide range of applicative conditions (e.g., EMI filter structures, load conditions, etc.). The circuit combination is a reliable and effectiveness solution regardless system operating conditions.

Of course, without prejudice to the principles of the present disclosure, the details of construction and the embodiments may vary widely with respect to what has been described and illustrated herein purely by way of example, without thereby departing from the scope of the present disclosure.

The various embodiments described above can be combined to provide further embodiments. These and other changes can be made to the embodiments in light of the above-detailed description. In general, in the following claims, the terms used should not be construed to limit the claims to the specific embodiments disclosed in the specification and the claims, but should be construed to include all possible embodiments along with the full scope of equivalents to which such claims are entitled. Accordingly, the claims are not limited by the disclosure. 

1. A detection circuit, comprising: a sensor circuit for connection to an X capacitor, said sensor circuit configured to generate a sensor signal indicative of a voltage at said X capacitor; a comparator circuit configured to generate a comparison signal by comparing said sensor signal with a threshold; a timer circuit configured to: set a discharge enable signal to a first logic level in response to said timer circuit being reset via a reset signal; and determine a time elapsed since said timer circuit has been reset via the reset signal; test whether said time elapsed exceeds a given timeout value; and in case said time elapsed exceeds said given timeout value, set said discharge enable signal to a second logic level to cause the active discharge circuit to discharge the X capacitor; an elaboration circuit configured to generate said reset signal for said timer circuit as a function of said comparison signal; and a dynamic threshold generator circuit configured to vary said threshold of said comparator circuit as a function of said sensor signal.
 2. The detection circuit of claim 1, wherein said dynamic threshold generator circuit is configured to vary in a feed-forward manner said threshold of said comparator circuit as a function of said sensor signal.
 3. The detection circuit of claim 2, wherein said dynamic threshold generator circuit comprises: a peak detector circuit configured to determine an upper threshold value indicative of a peak value of said sensor signal; and a threshold generator circuit configured to determine a lower threshold value as a function of said upper threshold value.
 4. The detection circuit of claim 3, wherein said comparator circuit comprises: a single comparator configured to generate the comparison signal indicating whether said sensor signal is greater than said lower threshold value; or a window comparator configured to generate the comparison signal indicating whether said sensor signal is between said lower threshold value and said upper threshold value.
 5. The detection circuit of claim 4, wherein said elaboration circuit is configured to: detect an edge of said comparison signal; and reset said timer circuit via said reset signal in response to detecting the edge of said comparison signal.
 6. The detection circuit of 4, wherein said elaboration circuit is configured to: test whether said comparison signal comprises both a leading and a falling edge; and in case said comparison signal comprises both said leading edge and said falling edge, determining a time elapsed between said leading edge and said falling edge; test whether said time elapsed between said leading edge and said falling edge is smaller than a given time threshold value; and reset said timer circuit via said reset signal in response to detecting that said time elapsed between said leading and said falling edge is smaller than said given time threshold value.
 7. The detection circuit of claim 1, wherein said dynamic threshold generator circuit is configured to vary in a feed-back manner said threshold of said comparator circuit as a function of said comparison signal.
 8. The detection circuit of claim 7, wherein said comparator circuit comprises: a first comparator configured to generate a first comparison signal indicating whether said sensor signal is greater than a first threshold value; and a second comparator configured to generate a second comparison signal indicating whether said sensor signal is greater than a second threshold value.
 9. The detection circuit of claim 8, wherein said dynamic threshold generator circuit is configured to: determine which of said first and second threshold values is greater; test whether said first and said second comparison signals indicate that said sensor signal is greater than both of said first and second threshold values; test whether said first and second comparison signals indicate that said sensor signal is smaller than both of said first and second threshold values; in case said first and said second comparison signals indicate that said sensor signal is greater than both of said first and second threshold values, increase the smaller one of said first or said second threshold values; and in case said first and said second comparison signals indicate that said sensor signal is smaller than both of said first and second threshold values, decrease the greater one of said first and said second threshold values.
 10. The detection circuit of claim 8, wherein said elaboration circuit is configured to: test whether said first and said second comparison signals indicate that said sensor signal is greater than both of said first and second threshold values; and reset said timer circuit via said reset signal in response to said first and said second comparison signals indicating that said sensor signal is greater than both of said first and second threshold values.
 11. An active discharge circuit, comprising: a detection circuit configured to generate a discharge enable signal signaling whether an AC oscillation is applied to an X capacitor of a device, wherein said detection circuit comprises: a sensor circuit for connection to said X capacitor, said sensor circuit configured to generate a sensor signal indicative of the voltage at said X capacitor; a comparator circuit configured to generate at least one comparison signal by comparing said sensor signal with at least one threshold; a timer circuit configured to: set said discharge enable signal to a first logic level responsive to said timer circuit being reset via a reset signal; determine the time elapsed since said timer circuit has been reset via a reset signal; test whether said time elapsed exceeds a given timeout value; and in case said time elapsed exceeds said given timeout value, set said discharge enable signal to a second logic level; an elaboration circuit configured to generate said reset signal for said timer circuit as a function of said at least one comparison signal; and a dynamic threshold generator circuit configured to vary said at least one threshold of said comparator circuit as a function of said sensor signal; and a discharge circuit adapted to be coupled to said X-capacitor and configured to discharge said X-capacitor as a function of said discharge enable signal generated by said detection circuit.
 12. The active discharge circuit of claim 11, wherein said discharge circuit comprises at least one electronic switch connected to a resistive element and/or a current generator.
 13. The active discharge circuit of claim 12, wherein the resistive element comprises a resistor and the current generator comprises a constant current generator, or either a linear or non-linear current generator.
 14. A method, comprising: detecting whether an AC oscillation is applied to an X capacitor of a device, the detecting including: monitoring a voltage at said X capacitor; generating at least one comparison signal by comparing said voltage at said X capacitor with at least one threshold; determining the presence or absence of said AC oscillation applied to an X capacitor as a function of said at least one comparison signal; and varying said at least one threshold as a function of said monitored voltage at said X capacitor.
 15. The method of claim 14, wherein monitoring the voltage at said X capacitor comprises: generating a sensor signal responsive to the voltage at said X capacitor; determining an upper threshold value indicative of a peak value of said sensor signal; and determining a lower threshold value as a function of said upper threshold value.
 16. The method of claim 15, wherein generating at least one comparison signal comprises generating a comparison signal indicating whether said sensor signal is contained in a voltage window defined by said lower threshold value and said upper threshold value.
 17. The method of claim 14, further comprising: detecting at least one of leading and falling edges of the comparison signal; incrementing a count value over time starting from an initial value for the count value; resetting the count value to the initial value as a function of the detected at least one of leaving and falling edges of the comparison signal; determining whether the count value has reached a time threshold value; and discharging the X capacitor responsive to the time count reaching the time threshold value.
 18. The method of claim 17, wherein the count value indicates a time between leading and falling edges of the comparison signal.
 19. The method of claim 14, wherein varying said at least one threshold as a function of said monitored voltage at said X capacitor comprises varying the at least one threshold value as a function the comparison signal.
 20. The method of claim 19, wherein the comparison signal comprises first and second comparison signals and wherein the method further comprises: generating a first comparison signal indicating whether said monitored voltage at said X capacitor is greater than a first threshold value; and generating a second comparison signal indicating whether said monitored voltage at said X capacitor is greater than a second threshold value. 